import {routerRedux} from 'dva/router'
import { post } from '@/utils/request';
import * as api from '@/constants/api';
import {toast, notify} from '@/utils/utils'

export default {
  namespace: 'forget',

  state: {

  },

  effects: {
    *sendVerifyCode({ payload }, { call, put }) {
      const response = yield call( ()=> post(api.FORGET_SEND_VERTIFY_CODE, payload) );
      toast('验证码发送成功')
    },
    *forgetPassword({ payload} , {call, put}){
      const response = yield call( ()=> post(api.FORGET_PASSWORD, payload) );
      notify('找回密码成功，请重新登录')
      yield put(routerRedux.replace('/user/login'))
    }
  },

  reducers: {

  },
};
